<?php

defined('_JEXEC') or die();

jimport('joomla.installer.helper');
jimport('joomla.installer.installer');

class ExtensionsHelper {

	var $installer;

	function __construct($repositroy) {
		$this->installer = new JInstaller();
	}
	
	function install($package) {
		
		$foldername = JInstallerHelper::unpack($package);
		
		$extractdir = $foldername['extractdir'];
		$packagefile = $foldername['packagefile'];
		
		if(@$this->installer->install($extractdir)) {
			JFolder::delete($extractdir);
			
			return true;
		}
		else {
			return false;
		}
	}
}